package com.stadium.servlet.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import com.stadium.bean.Place;
import com.stadium.repository.PlaceOrderRepository;
import com.stadium.repository.PlaceRepository;
import com.stadium.servlet.PlaceService;

@Service("PlaceService")
public class PlaceServiceImpl implements PlaceService {

	@Autowired
	private PlaceRepository placeRepository;

	public List<Place> findAll() {
		return placeRepository.findAll();
	}

	public void addPlace(Place palce) {
		placeRepository.save(palce);
	}

	public void deletePlace(Integer placeId) {
		placeRepository.delete(placeId);
	}

	public void updataPlace(Place place) {
		placeRepository.saveAndFlush(place);
	}

	public List<Place> findAllByName(String name) {
		return placeRepository.findByplaceNameLike(name);
	}

}
